﻿using FormulaRunning.Models;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;
using System.Linq;
using System.Web;

namespace FormulaRunning.DAL
{
    public class FormulaContext : DbContext
    {
        public DbSet<Formula> Formulas { get; set; }
        public DbSet<Tag> Tags { get; set; }
        public DbSet<Comment> Comments { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
            // modelBuilder.Entity<Course>().HasMany(c => c.Instructors).WithMany(i => i.Courses)
            modelBuilder.Entity<Formula>().HasMany(c => c.Comments).WithRequired(i => i.Formula);
        }

        public DbSet<UserProfile> UserProfiles { get; set; }
    }
}